package com.hackathon.chgk.activities;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Typeface;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import com.hackathon.chgk.ChgkApplication;
import com.hackathon.chgk.R;

public class MainActivity extends Activity {
    
	/** Called when the activity is first created. */
    private Button newGameButton;
    private Button settingsButton;    
   // private Button continButton;    
    private Button trainingButton; 
    SharedPreferences gameSettings;
    
	static final String CLASSNAME = MainActivity.class.toString();
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.main);     
			
        //continButton = (Button)findViewById(R.id.main_continie_button);
        trainingButton = (Button)findViewById(R.id.main_traning_button);
        newGameButton = (Button)findViewById(R.id.main_newgame_button);
        settingsButton = (Button)findViewById(R.id.main_settings_button);        
       
        Typeface gameFont = Typeface.createFromAsset(getAssets(), "font/Gabriola.ttf");
        //continButton.setTypeface(gameFont);
        trainingButton.setTypeface(gameFont);
        newGameButton.setTypeface(gameFont);
        settingsButton.setTypeface(gameFont);
        
        trainingButton.setOnClickListener(new OnClickListener() {			
			public void onClick(View v) {
				
				Intent i = new Intent(MainActivity.this, TrainingActivity.class);
				startActivity(i);
			}
		});
        
        newGameButton.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				
				Intent i = new Intent(MainActivity.this, GameActivity.class);
				startActivity(i);
			}
		});
        
        settingsButton.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				
				Intent i = new Intent(MainActivity.this, Preferences.class);
				startActivity(i);	
			}
		});        
        
        ChgkApplication app = ChgkApplication.getInstance();  
        app.setCurrentContext(this);
        
	}
		
	@Override
	protected void onStart() {
		// TODO Auto-generated method stub
		super.onStart();
		Log.d("kirik",this.getClass().getName());
		ChgkApplication.getInstance().setCurrentContext(this);
	}
	
}